home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / desq5x.zip / DESQ5X.ASM < prev    next >
Assembly Source File  |  1993-01-04  |  4KB  |  122 lines

  1. PAGE 80,132
  2. TITLE DESQview TP 5.0 interfaces, Ver 5.X
  3.  
  4. ; DESQ5X.ASM - DESQview interface routines
  5. ;  by  James H. LeMay, CIS 76011,217
  6. ;  for Eagle Performance Software
  7. ;      P.O. Box 122237
  8. ;      Ft. Worth, TX  76121
  9. ; These procedures are published in the DESQview users manual and
  10. ; have been modified for use for TP 5.0.  Note that some of these
  11. ; routines are useful for direct screen writing utilities
  12. ; like QWIK5X.ARC
  13. ; Only uses 95 bytes of code.
  14.  
  15. DATA    SEGMENT WORD PUBLIC
  16.         EXTRN  In_DV:  BYTE    ; defaults as FALSE in DESQxx.PAS
  17. DATA    ENDS
  18.  
  19. CODE    SEGMENT WORD PUBLIC
  20.         ASSUME  CS:CODE, DS:DATA
  21.         PUBLIC  DV_GET_VERSION
  22.         PUBLIC  DV_GET_VIDEO_BUFFER
  23.         PUBLIC  DV_PAUSE
  24.         PUBLIC  DV_BEGIN_CRITICAL
  25.         PUBLIC  DV_END_CRITICAL
  26.  
  27.  
  28. DV_GET_VERSION  PROC  FAR
  29. ; function DV_Get_Version: word;
  30. ; Returns in AH/AL the DESQview major/minor version numbers,
  31. ;   and sets up the In_DV variable for later use.
  32. ; Returns 0 in AX if DESQview isn't there.
  33.         mov   cx,'DE'        ; Set CX to 4445h; DX to 5351h
  34.         mov   dx,'SQ'        ; (an invalid date)
  35.         mov   ax,2B01h       ; DOS's set date function
  36.         int   21h            ; call DOS
  37.         cmp   al,0FFh        ; did DOS see it as invalid?
  38.         je    NoDV           ; if so, DESQview isn't there
  39.         xchg  ax,bx          ; AH=major version; AL=minor version
  40.         mov   In_DV,1        ; Set In_DV = true
  41.         jmp   SHORT DVGV_X   ;
  42. NoDV:   xor   ax,ax          ; Set AX    = false (No DESQview)
  43.         mov   In_DV,al       ; Set In_DV = false (this was left out
  44.                              ;   of the publication!)
  45. DVGV_X: ret
  46. DV_GET_VERSION  ENDP
  47.  
  48.  
  49. VideoSeg   EQU   [bp+6]
  50.  
  51. DV_GET_VIDEO_BUFFER  PROC  FAR
  52. ; function DV_Get_Video_Buffer (VideoSeg: word): word;
  53. ; Takes the hardware video segment and returns the same
  54. ; segment (if DESQview is not present) or DESQview's alternate
  55. ; video buffer (in AX).  Sets up the In_DV variable for later use.
  56. ; Call this instead of DV_GET_VERSION_ if your program writes
  57. ; directly to video memory.
  58. ; Note: DV keeps the alternate buffer paragraph aligned so only
  59. ; the segment is needed.
  60.         push  bp             ; Set turbo's stack frame
  61.         mov   bp,sp          ;
  62.         call  DV_GET_VERSION ; Returns AX=0 if not in DESQview
  63.         mov   es,VideoSeg    ; Put hardware segment in ES
  64.         xor   di,di          ; Put hardware offset in DI (usually 0)
  65.         test  ax,ax          ; In DV?
  66.         jz    DVGVB_X        ;   No, jump.
  67.                              ;   Yes, get new buffer segment
  68.         mov   ah,0FEh        ; DV's get buffer function
  69.         int   10h            ; Returns ES:DI as alternate buffer
  70. DVGVB_X:mov   ax,es          ; Return correct video buffer
  71.         pop   bp             ; Restore Turbo's BP
  72.         ret   2
  73. DV_GET_VIDEO_BUFFER  ENDP
  74.  
  75.  
  76. API_CALL  PROC  NEAR
  77. ; This local routine takes a program interface function in BS,
  78. ; and makes that call to DESQview after swithching onto a stack
  79. ; that DESQview provides for your program.
  80.         mov   ax,101Ah       ; The function to switch to DV's stack
  81.         int   15h            ; DV's software interrupt
  82.     mov   ax,bx          ; Move the desired function to AX
  83.     int   15h            ; Make that call
  84.         mov   ax,1025h       ; Function to switch off DV's stack
  85.     int   15h            ; Make that call
  86.         ret
  87. API_CALL  ENDP
  88.  
  89.  
  90. DV_PAUSE  PROC  FAR
  91. ; procedure DV_Pause;
  92. ; This procedure gives up the rest of your program's time slice.
  93.         mov   bx,1000h       ; This is the function code
  94.         jmp   SHORT DV_API   ; Finish routine
  95. DV_PAUSE  ENDP
  96.  
  97.  
  98. DV_BEGIN_CRITICAL  PROC  FAR
  99. ; procedure DV_Begin_Critical;
  100. ; This routine tells DESQview not to slice away from your program
  101. ; until you make a DV_END_CRITICAL call.
  102.         mov   bx,101Bh       ; This is the function code
  103.         jmp   SHORT DV_API   ; Finish routine
  104. DV_BEGIN_CRITICAL  ENDP
  105.  
  106.  
  107. DV_END_CRITICAL  PROC  FAR
  108. ; procedure DV_End_Critical;
  109. ; This routine tells DESQview that it is all right to slice away
  110. ; from your program again.
  111.         mov   bx,101Ch       ; This is the function code
  112. DV_API: cmp   In_DV,1        ; Are we in DESQview?
  113.         jne   DVEC_X         ; If not, nothing to do
  114.         call  API_CALL       ; Do it
  115. DVEC_X: ret
  116. DV_END_CRITICAL  ENDP
  117.  
  118.  
  119. CODE    ENDS
  120.  
  121.         END
  122.